/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.swarm;

import it.free.i.virtual.machine.hal.devicealias.command.DeviceAliasPortCommand;

import java.util.Date;
import java.util.Hashtable;

/**
 * Implements the compose-able information unit paradigm
 * @author stefano
 */
public class ComposableInformationUnitDefaultImpl extends Hashtable<String, String> implements ComposableInformationUnit {

	private static final long serialVersionUID = 2118610422323210096L;
	private CIUGeneratorAllowedOperations ciuGeneratorCapability = null;
	private DeviceAliasPortCommand deviceAliasPortCommand = null;
	private String ciuType = null;

	/**
	 * @return the type of operation that generated the CIU
	 */
	public CIUGeneratorAllowedOperations getCiuGenerator() {
		
		return this.ciuGeneratorCapability; 
	}

	/**
	 * @param ciuGenerator the type of operation that generated the CIU, to set
	 */
	public void setAllowedOperations(CIUGeneratorAllowedOperations ciuGenerator) {
		this.ciuGeneratorCapability = ciuGenerator;
	}

	public void setAttribute(String propertyName, int propertyValue) {
		super.put(propertyName, String.valueOf(propertyValue));
	}

	public void setAttribute(String propertyName, String propertyValue) {
		super.put(propertyName, String.valueOf(propertyValue));
	}

	public void setAttribute(String propertyName, boolean propertyValue) {
		super.put(propertyName, String.valueOf(propertyValue));
	}
	
	public void setAttribute(String propertyName, Date propertyValue) {
		super.put(propertyName, String.valueOf(propertyValue));
	}

	public void setAttribute(String propertyName, float propertyValue) {
		super.put(propertyName, String.valueOf(propertyValue));
	}

	public void setAttribute(String propertyName, double propertyValue) {
		super.put(propertyName, String.valueOf(propertyValue));
	}

	public void setOperation(DeviceAliasPortCommand deviceAliasPortCommand) {
		this.deviceAliasPortCommand = deviceAliasPortCommand;
	}

	public DeviceAliasPortCommand getOperation() {
		return deviceAliasPortCommand;
	}

	/**
	 * @return the ciuType
	 */
	public String getCiuType() {
		return ciuType;
	}

	/**
	 * @param ciuType the ciuType to set
	 */
	public void setCiuType(String ciuType) {
		this.ciuType = ciuType;
	}	
}
